class RemoveArticlesInPostsColumn < ActiveRecord::Migration
  def self.up
    ActiveRecord::Base.transaction do
      execute "delete from discussions where type = 'Article'"
      execute "update documents set attachable_type = 'Article' where attachable_type = 'Post'"
      remove_column :discussions, :type
    end
  end

  def self.down
    add_column :discussions, :type, :string
  end
end
